//
//  DelayInit.swift
//  JLCommonKit
//
//  Created by Jiang Chencheng on 2024/8/1.
//

import Foundation

@propertyWrapper
public struct Late<Value> {
    private var value: Value?

    public init() {}

    public var wrappedValue: Value {
        get {
            guard let value = value else {
                fatalError("Property accessed before being initialized.")
            }
            return value
        }
        set { value = newValue }
    }

    public mutating func reset() {
        value = nil
    }
}

